import { ElMessage, ElMessageBox } from "element-plus";

export function showMessage(
  message: string,
  type: "success" | "error" | "info" | "warning" = "success"
) {
  ElMessage({
    message,
    type,
    center: true,
    showClose: true,
    grouping: true,
    offset: window.screen.height / 9,
  });
}
export function showConfirmDialog(
  message: string,
  title: string,
  type: "warning" | "success" | "info" | "error" = "warning"
) {
  return ElMessageBox.confirm(message, title, {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type,
    center: true,
  })
    .then(() => {
      // 确认按钮点击后的逻辑
      return true;
    })
    .catch(() => {
      return false;
    });
}
